<?php
	include_once 'checkloginstatus.php';
    include_once '../mysqldb/MySqlHelper.php';
    include_once '../plugin/common.php';
    if (isset($_GET['id'])) {
    	if (is_numeric($_GET['id'])) {
    		$MySqlHelper = new MySqlHelper();
    		
    		$row = $MySqlHelper->GetRow('select imgUrl from ProductShow where ID = '.$_GET['id']);
    		DeletePic($row['imgUrl']);
    		DeletePic(str_replace('Thum.jpg', '',$row['imgUrl']));
    		
    		$MySqlHelper->ExecSql('delete from ProductShow where ID = '.$_GET['id']);
    		AlertAndGo('删除成功！','productimg.php?pid='.$_GET['pid']);
    	}
    }
    function DeletePic($picName){
    	$filePath=dirname(__FILE__).'/RTBEditor/attached/ProductImg/'.$picName;
    	if (is_readable($filePath)) {
    		unlink($filePath);
    	}
    }